home *** CD-ROM | disk | FTP | other *** search
/ Ham Radio 2000 / Ham Radio 2000.iso / ham2000 / satellit / pacdoc / bdcastu2.asc < prev    next >
Text File  |  1991-11-04  |  19KB  |  484 lines

  1. Regular Broadcasting of PACSAT File Headers 
  2. DRAFT
  3. 04 November 1991
  4.  
  5. [All changes and additions in this DRAFT are PROPOSED, and should not be 
  6. considered final until a subsequent RELEASE version of this document is 
  7. published.]
  8.  
  9. JW Ward, G0/K8KA
  10. HE Price, NK6K
  11.  
  12. DISCUSSION 
  13.  
  14. In the past 18 months the PACSAT Broadcast Protocol has proven to be a very 
  15. efficient means of downloading information from the LEO store-and-forward 
  16. satellites. It makes good use of the available bandwidth, and especially 
  17. efficient use of available pass time. The authors always intended to extend 
  18. this datagram facility to the provision of a "file directory" for the PACSAT 
  19. server. Since all stations need an up to date directory, this is a prime 
  20. candidate for point-to-multipoint distribution.
  21.  
  22. A PACSAT file server's "directory entries" are, in fact, PACSAT File Headers 
  23. (PFHs). The PFH contains all of the important information about a file (name, 
  24. number, upload time, title, addresses, etc.). This information is present in 
  25. the PFH form on the server, and routines for interpretation of the PFH are 
  26. present in the client software. The PFH is the natural data structure in which 
  27. to present "broadcast directories."
  28.  
  29. The broadcast directory service will, therefore, consist of periodic 
  30. transmission of PFHs in special Directory Broadcast datagrams. The 
  31. transmissions will be either automatic or client initiated. This protocol 
  32. (see Appendix A) specifies the format for Directory Broadcasts and for 
  33. Directory Broadcast Requests. The protocol does not specify when a server 
  34. might periodically transmit PFHs without client requests, but such automatic 
  35. directory broadcasts will be implemented on the existing PACSAT servers.
  36.  
  37. CHOOSING A HANDLE
  38.  
  39. Having decided that a "directory entry" is a PFH and that "directory 
  40. broadcasting" is PFH broadcasting, we must address the problem of how the 
  41. client can assure that it has received a complete and up-to-date directory 
  42. from the server. 
  43.  
  44. Although the server uniquely identifies each file with an identification 
  45. number, this is not necessarily the best way to for the client to request 
  46. directory entries from the server. A system based on file numbers will not 
  47. always assure that the client receives directories for all "new" files. The 
  48. following cases illustrate this:
  49.  
  50. (1) Partial Uploads
  51.  
  52. When a client begins uploading a file, the server assigns a file number. The 
  53. client may not finish uploading the file for some time. Only when the file 
  54. upload is finished is the file a "new" file.
  55.  
  56. (2) Non-existent Files
  57.  
  58. Some file numbers are used only briefly (e.g. for temporary files) and may 
  59. never be associated with a "new" file (as seen by the clients).
  60.  
  61. (3) Non-PACSAT Files
  62.  
  63. Files created by on-board processes, but lacking the PFH. They cannot be 
  64. downloaded or uploaded. As far as the PACSAT protocol suite is concerned, 
  65. these are like (2).
  66.  
  67. (4) Daily Log Files
  68.  
  69. The server and its processes also maintain daily logs which, although they may 
  70. become "new" several times during a day, will cease to grow after midnight.
  71.  
  72. (5) Continuous Log Files
  73.  
  74. The server and processes on the server maintain log files. These files become 
  75. "new" every time something is written into them.
  76.  
  77. During the design of the directory broadcast protocol, we attempted to solve 
  78. these problems using simple measures which would still allow file number to be 
  79. the primary directory request handle. Problems persisted both in the complete 
  80. specification of the protocol and in a prototype implementation of the 
  81. groundstation receiving software.
  82.  
  83. Eventually the file-number-based scheme was abandoned in favour of a slightly 
  84. more complex protocol providing two "time limits" with each broadcast 
  85. directory entry: an "older limit" , t_old,  and a "newer limit", t_new. Thus, 
  86. as well as containing a PFH, each broadcast directory entry gives the client a 
  87. pair numbers (t_old, t_new). The proper interpretation of this pair is 
  88.  
  89.      "There   are  no  files  other  than  this  file   with 
  90.      UPLOAD_TIME >= t_old and <= t_new."
  91.  
  92. The client maintains a list of holes in its directory time line using the 
  93. t_old and t_new information. Requests to the server for hole fills use these 
  94. times, rather than file numbers.
  95.  
  96. EXAMPLES
  97.  
  98. [N.B.: Small times have been used deliberately in the examples; real satellite 
  99. times are the number of seconds elapsed since 00:00:00 1/1/80. Also, the 
  100. satellite file system assures that no two files will ever have the same 
  101. UPLOAD_TIME.]
  102.  
  103. For example, a client with no previous directory information assumes that it 
  104. has a directory hole from
  105.  
  106. 0 - FOREVER
  107.  
  108. Upon receiving a directory broadcast with (t_old, t_new)
  109.  
  110. (0, 50)
  111.  
  112. the client's directory hole list would look like
  113.  
  114. 51 - FOREVER
  115.  
  116. and the client software is confident that there are no older files.
  117.  
  118. The list can get fragmented, e.g. if the client now receives
  119.  
  120. (120, 150)
  121.  
  122. and the time hole list looks like:
  123.  
  124. 51 - 119
  125. 151 - FOREVER
  126.  
  127. Requests from the client to the sever are time hole lists. In effect, they 
  128. request that the server transmit any directory entries in the hole OR an entry 
  129. which shows that there are no directories in the hole. 
  130.  
  131. FLEETING HOLES
  132.  
  133. The server sets time limits for a particular directory broadcast by examining 
  134. the next newer and previous older files on the system. These files, however, 
  135. may move or be deleted, hence the need to show that a hole no longer holds any 
  136. directories. Starting from the previous example, say that the server creates 
  137. files at t=151, t=152 and t=153, thus it would transmit
  138.  
  139. [a] (120, 151) (PFH for t=151)
  140. [b] (152, 152) (PFH for t=152)
  141. [c] (153, 153) (PFH for t=153)
  142.  
  143. A client receiving [a] and [c], but missing [b] would have a hole
  144.  
  145. 152 - 152 
  146.  
  147. in its directory time line, and might assume that there was a file to fill 
  148. that hole. But the server might delete the file t=152. Thus, when the client 
  149. requests a fill for
  150.  
  151. (152,152)
  152.  
  153. the server would respond with
  154.  
  155. [c'] (152, 153) (PFH for t=153)
  156.  
  157. which allows the client to fill its hole, but does not contain a directory 
  158. entry for t=152. 
  159.  
  160. MARKING THE LIMITING FILES
  161.  
  162. It is convenient for the client to know when it has received the directory for 
  163. the current newest file. The server will mark this file with a special flag. 
  164. The oldest file will always have t_old==0.
  165.  
  166. BACKWARD COMPATIBLE IMPLEMENTATION 
  167.  
  168. Unfortunately, adding new data and request frame formats to the existing 
  169. broadcast protocol in a backward compatible manner required some compromises. 
  170. On inspection of the existing FRAME_HEADER for broadcast data packets, there 
  171. is no clear indication of frame type! Strictly speaking, the reserved bits of 
  172. the FRAME_HEADER.flags byte could be used to indicate that the frame was a 
  173. directory broadcast frame. Unfortunately, PB at least does not check these 
  174. bits, and any new directory broadcasts would terminally confuse PB. We expect 
  175. that clients will try to get updated broadcast receiver software, but we don't 
  176. want to force the pace of this change by causing the current implementation to 
  177. crash.
  178.  
  179. We completely avoid this problem, by specifying a separate PID for directory 
  180. broadcast and request frames. This should allow existing groundstation 
  181. software to co-exist with the new broadcast directories.
  182.  
  183. IMPLEMENTATION NOTES
  184.  
  185. A single implementation of PACSAT Protocol Suite software runs on UO-14, AO-
  186. 16, LO-19 and UO-22. Although there are minor variations from satellite to 
  187. satellite, these are generally related to ongoing upgrades rippling through 
  188. the system. There are some implementation peculiarities, and some ad-hoc 
  189. additions have been made to the standard broadcast protocol. These matters are 
  190. documented here, but are not added to the formal specification.
  191.  
  192. Queue Management
  193. ----------------
  194.  
  195. The server maintains a queue with 10 entries; each entry is a hole list 
  196. request or broadcast start request. A particular station (as identified by 
  197. callsign, not including SSID) can have only one entry on the queue.
  198.  
  199. Entries are removed from the queue: 
  200.      after 10 minutes;
  201.      after a hole list has been completely transmitted (for hole list);
  202.      after a file has been completely transmitted (for start request);
  203.      when a new request is received from a station already in the queue;
  204.      if the file associated with the entry cannot be opened and read;
  205.  
  206. Broadcast Request Response Messages
  207. -----------------------------------
  208.  
  209. When the server receives a request frame from a client, it will respond 
  210. immediately indicating the success or failure of the request. This response is 
  211. intended for use in manually operated stations; because of timing and 
  212. reliability problems, its use in automated broadcast request systems is 
  213. discouraged.
  214.  
  215. The request response message is an AX.25 UI frame from the server callsign to 
  216. the client callsign with the PID 0xf0. [NB - this is a change of the PID.] The 
  217. data portion of the packet has no header or CRC. The data is in ASCII as 
  218. follows:
  219.  
  220. <"OK "|"NO ">[<errorcode>]<callsign><CR>
  221.  
  222. "OK " indicates that the request was successful. There is no <errorcode>.
  223.  
  224. "NO " indicates that the request failed for some reason. In this case, the 
  225. <errorcode> is an ascii representation of an error number followed by one 
  226. blank space, e.g. "NO -1 ". The error codes for broadcast start requests and 
  227. hole list requests should be interpreted as follows:
  228.  
  229.                -1       Temporary problem, e.g. queue full or server closed
  230.                -2       Permanent problem, e.g. file does not exist.
  231.  
  232.  
  233. Broadcast Server Status Message
  234. -------------------------------
  235.  
  236. The format of the PBLIST message will be altered to include (at the option of 
  237. spacecraft controllers) the number of the file being broadcast. The format of 
  238. the PBLIST message will now be one of the following - 
  239.  
  240. If file numbers are disabled:
  241.  
  242. PB: <call> ...
  243. PB: <call>\P ...
  244. PB: <call>\D ...
  245.  
  246. If file numbers are enabled:
  247.  
  248. PB: <call>\<fnumber> ...
  249. PB: <call>\P\<fnumber> ...
  250. PB: <call>\D ...
  251.  
  252. \P        indicates that the request is permanent 
  253. \D        indicates that the request is a directory request
  254. <call>     is the callsign of the requesting station, without SSID
  255. <fnumber>  is the hexadecimal file number of the requested file
  256.  
  257. If the queue is empty, the message will be :
  258.  
  259. PB: Empty.
  260.  
  261. These messages will be transmitted to PBLIST-0 with PID 0xF0.
  262.  
  263. File Types
  264. ----------
  265.  
  266. There is still some confusion regarding compressed files. The intent was to 
  267. place all compression information in the compression_type field and all file 
  268. format information in the file_type field. Thus, as per the FTL0 update 
  269. released 22 March 1991:
  270.  
  271.      Delete  file  type 0x0a, "Simple ASCII text  file,  but 
  272.      compressed"  from Appendix A, PACSAT FILE  TYPES.  This 
  273.      type of file should be indicated by file_type 0x00  and 
  274.      a non-zero compression_type item.
  275.  
  276. We propose to fix the conflict between "miscelaneous binary" and "activity 
  277. log" by changing the activity log file type. Since only Harold and I have to 
  278. take action to implement this solution, it is more likely to succeed than 
  279. trying to recall every copy of PFHADD.
  280.  
  281. Suggestions regarding additional, more-informative, file types are solicited. 
  282.  
  283. Compression Types
  284. -----------------
  285.  
  286. The PFH protocol was designed to be flexible. We should now add a compression 
  287. type for the popular LHARC program. Add to APPENDIX B of the document "PACSAT 
  288. File Header Definition"
  289.  
  290.      0x03      body compressed using LHARC.
  291.  
  292. --------------------------------------------------------------
  293. --------------------------------------------------------------
  294. BROADCAST DIRECTORY PROTOCOL PROPOSED ADDITIONS TO APPENDIX A
  295. OF THE PACSAT BROADCAST PROTOCOL SPECIFICATION
  296. --------------------------------------------------------------
  297.  
  298. PACSAT BROADCAST PROTOCOL ADDENDUM - PFH BROADCASTS
  299.  
  300. A.5 Directory Broadcasts
  301.  
  302. The server will transmit directory information automatically and/or as the 
  303. result of Directory Requests from clients. The directory information provided 
  304. is the PACSAT File Header (PFH). For a particular file, the directory entry 
  305. will be transmitted in one or more Directory Broadcast frames, each of which 
  306. is carried in the data portion of an AX.25 UI frame. Each frame will also 
  307. contain the DIR_HEADER described below.
  308.  
  309. To aid the client in maintaining its directory database and requesting up-to-
  310. date directory entries, Directory Broadcast frames include time limits. These 
  311. limits allow the client to maintain a "time line" of directory entries and to 
  312. determine when the time line is complete and up-to-date.
  313.  
  314. Servers will periodically transmit the directories for the most recently 
  315. uploaded files. Other directory entries can be requested by the client using a  
  316. Directory Request frame. The Directory Request format allows clients to 
  317. request that the server transmit directories for all files with UPLOAD_TIME in 
  318. a particular range. This is equivalent to filling holes in the directory time 
  319. line.
  320.  
  321. A.5.1 Directory Broadcast frame format
  322.  
  323. A directory entry is transmitted as one or more directory broadcast frames.
  324.  
  325. Directory broadcast frames consist of header, data and CRC. The header is 
  326. fixed length, and the data is variable length.
  327.  
  328. A directory broadcast frame is wholly contained in the data portion of an 
  329. AX.25 UI frame.
  330.  
  331. A <UI> frame containing a directory broadcast frame uses a PID of 0xbd.
  332.  
  333. A <UI> frame containing a directory broadcast frame uses a source address of 
  334. the transmitting station, and a destination address of QST-1.
  335.  
  336. A.5.1.1 Frame Header
  337.  
  338. Each directory broadcast frame consists of a header occupying the first 17 
  339. bytes of the frame. The structure of the frame header is as follows:
  340.  
  341. <flags><file_id><offset><t_old><t_new>
  342.  
  343. This structure follows the PACSAT Data Specification Standards as regards 
  344. field size and byte order; these are defined in a separate document.
  345.  
  346. struct DIR_HEADER {
  347.      unsigned char flags;
  348.      unsigned long file_id;
  349.      unsigned long offset;
  350.      time_t t_old;
  351.      time_t t_new;
  352. }
  353.  
  354.  
  355. flags          A bit field as follows:
  356.  
  357.      7  6  5  4  3  2  1  0
  358.     /----------------------\
  359.     |*  N  E  0  V  V  T  T|
  360.     \----------------------/
  361. TT                  Two bit frame type identifier
  362.                     00   PFH broadcast 
  363.                     01   reserved
  364.                     10   reserved
  365.                     11   reserved
  366.  
  367. VV                  Two bit version identifier.  This version is 00.
  368.  
  369. 0                   Always 0 indicates a server generated frame.
  370.  
  371. E              1    Last byte of frame is the last byte of the directory PFH.
  372.                0    Not the last frame.
  373.  
  374. N              1    This is the newest file on the server.
  375.                0    This is not the newest file on the server.
  376.  
  377. *                   Reserved, always 0.
  378.  
  379.  
  380. file_id    A number which identifies the file.  All directory broadcast 
  381. frames which are part of the same file's PFH are tagged with this number.
  382.  
  383. offset     This is  the offset from the start of the PFH for the first data 
  384. byte in this frame.  
  385.  
  386. t_old     Number of seconds since 00:00:00 1/1/80. See below.
  387.  
  388. t_new     Number of seconds since 00:00:00 1/1/80. See below.
  389.  
  390.      There  are no files other than the file  identified  by 
  391.      file_id with t_old <= UPLOAD_TIME <= t_new.
  392.  
  393. A.5.1.2 Data
  394.  
  395. The data portion of a directory broadcast frame will contain all or part of 
  396. the PACSAT File header from the file identified by <file_id>. The <offset> 
  397. field indicates where the data from the current frame belongs in the PFH. 
  398.  
  399. An <offset> of 0 and a <flags> field with the E bit set to 1 indicates that 
  400. this directory broadcast frame contains the entire PFH for the identified 
  401. file.
  402.  
  403. A.5.1.3 CRC
  404.  
  405. The CRC covers the header and data portions of the directory broadcast frame. 
  406. It is the XMODEM CRC as defined in section A.2.1.3.
  407.  
  408. A.5.2 Directory Broadcast Requests
  409.  
  410. Clients may request that the server transmit directory broadcasts for files 
  411. with UPLOAD_TIME within a certain range. If entries from several ranges are 
  412. required, multiple ranges can be included in a single request.
  413.  
  414. A.5.2.1 Request Frame
  415.  
  416. A directory broadcast request frame consists of header and data. The header is 
  417. fixed length, and the data portion is variable length.
  418.  
  419. The directory broadcast request frame is wholly contained within a standard 
  420. AX.25 <UI> frame.  The total length of the request frame may not exceed the 
  421. length of a legal AX.25 <UI> frame.
  422.  
  423. A <UI> frame containing a request frame uses the same PID as a directory 
  424. broadcast frame: 0xbd.  The source address is the address of the transmitting 
  425. station, the destination address is the address of the server to which the 
  426. request is directed.  
  427.  
  428. A.5.2.2 Request Header
  429.  
  430. The format of the directory broadcast request header is:
  431.  
  432. struct DIR_REQ_HEADER{
  433.      unsigned char flags;
  434.      int block_size;
  435. }
  436.  
  437. flags          - A bit field as follows:
  438.  
  439.      7  6  5  4  3  2  1
  440.     /-------------------\
  441.     |*  *  1  V  V  C  C|
  442.     \-------------------/
  443.  
  444. CC                  Two bit field as follows:
  445.  
  446.                     00   directory fill request.
  447.                     01   reserved
  448.                     10   reserved
  449.                     11   reserved
  450.  
  451. VV                  Two bit version identifier.  This version is 00.
  452.  
  453. 1                   Always 1 indicates a client-generated frame.
  454.  
  455. *                   Reserved, must be 0.
  456.  
  457.  
  458. <block_size> is the number of data bytes which the server should place in each 
  459.      directory broadcast frame.
  460.  
  461. 5.2.3 Data
  462.  
  463. If the CC field is 00, a list of UPLOAD_TIME ranges is present. 
  464.  
  465. The format of the list is pairs times (number of seconds since 00:00:00 
  466. 1/1/80.)
  467.  
  468. struct PAIR {
  469.      time_t start
  470.      time_t end
  471. };
  472.  
  473. For each PAIR, the server will transmit directories for those files with 
  474. UPLOAD_TIME greater than or equal to <start> and less than or equal to <end>. 
  475.  
  476. If there are no files within the range, the directory for the first file with 
  477. upload time greater than <end> will be transmitted. If there is no such file, 
  478. the directory for this first file with upload time less than <start> will be 
  479. transmitted. In either case, the <t_old> and <t_new> fields in this directory 
  480. will indicate to the client that there are no entries between <start> and 
  481. <end>. 
  482.  
  483. <END>
  484.